<?php /* Smarty version 2.6.18, created on 2016-11-30 18:02:41
         compiled from achieve/m.achieve.add.tpl.php */ ?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="mstatic/css/bootstrap.min.css"  type="text/css" rel="stylesheet">
<link href="mstatic/css/jquery-ui.css"  type="text/css" rel="stylesheet">
<link href="mstatic/css/index.css" type="text/css" rel="stylesheet">
<title>教务处--教学成果-添加</title>
</head>

<body>
<!--头部-->
<nav class="navbar navbar-default navbar-fixed-top  top" role="navigation">
  <div class="container-fluid">
    <div class="navbar-header" style=" width:100%;"> <a class="navbar-brand" href="javascript:history.go(-1);" style=" width:100%;  padding-right:0px;"> <span class="glyphicon glyphicon-arrow-left white"></span> 
      <!--    <span class="glyphicon glyphicon-pause white" style="margin-left:2%;"></span>--> 
      <span class="white" style="margin-left:10%">教学成果-添加</span> <span class="glyphicon glyphicon-user white" style="float:right"></span> </a> </div>
  </div>
  <!-- /.container-fluid --> 
</nav>
<!--头部 end--> 
<!--主体部分-->
<div class="container" style="margin-top:70px;">
  <div class="row row_margin">
    <form name="myform" action="" method="post" role="form" enctype="multipart/form-data">
    
     <div class="form-group">
        <label for="" class="col-sm-2  control-label">获奖名称：</label>
        <div class="col-sm-10 ">
           <input type="text" name="achieve_name" class="form-control" required="required">
         </div>
     </div>
	 <?php if ($this->_tpl_vars['type'] == 6): ?>

      <div class="form-group">
        <label for="" class="col-sm-2  control-label">出版社：</label>
        <div class="col-sm-10 ">
           <select class="form-control" id="s1" onchange="a()" name="achieve_publish">
				<option value=""> 请选择</option>
				<?php $_from = $this->_tpl_vars['publish_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
				<option value="<?php echo $this->_tpl_vars['value']['publish_id']; ?>
"><?php echo $this->_tpl_vars['value']['publish_name']; ?>
</option>
				<?php endforeach; endif; unset($_from); ?>
				<option value="自定义"> 自定义</option>
			</select>
			<input id="new" class="form-control" placeholder="添加新的" name="resttype_name">
			<span class="btn btn-default" id="add" style="font-size:12px">添加</span>
         </div>
     </div> 
      <div class="form-group">
        <label for="" class="col-sm-2  control-label">书号：</label>
        <div class="col-sm-10 ">
          <input type="text" name="achieve_bookno" class="form-control" required="required">
        </div>
      </div>
      <div class="form-group">
        <label for="" class="col-sm-2  control-label">所在页：</label>
        <div class="col-sm-10 ">
          <input type="text" name="achieve_page" class="form-control" required="required">
        </div>
      </div>
	  <?php endif; ?>
	  <?php if ($this->_tpl_vars['type'] != 6): ?>

       <div class="form-group">
        <label for="" class="col-sm-2  control-label">主办单位：</label>
        <div class="col-sm-10 ">
          <input type="text" name="achieve_unit" class="form-control" required="required">
        </div>
      </div>
	  <?php if ($this->_tpl_vars['type'] != 7): ?>
       <div class="form-group">
        <label for="" class="col-sm-2  control-label">获奖名次：</label>
        <div class="col-sm-10 ">
         <select class="form-control" name="achieve_rank">
			<?php $_from = $this->_tpl_vars['prize']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
			<option value="<?php echo $this->_tpl_vars['value']['prize_id']; ?>
"> <?php echo $this->_tpl_vars['value']['prize_name']; ?>
</option>
			<?php endforeach; endif; unset($_from); ?>
		 </select>
        </div>
      </div>
     <?php else: ?>
      <div class="form-group">
        <label for="" class="col-sm-2  control-label">第一指导老师：</label>
        <div class="col-sm-10 ">
			<select class="form-control" name="achieve_teach">
				<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
				<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
				<?php endforeach; endif; unset($_from); ?>
			</select>
        </div>
      </div>
      
      <div class="form-group">
        <label for="" class="col-sm-2  control-label">本人名次：</label>
        <div class="col-sm-10 ">
         <input type="text" name="achieve_trank" class="form-control" required="required">
        </div>
      </div>
      <?php endif; ?>
	  <?php endif; ?>
      <div class="form-group">
        <label for="" class="col-sm-2  control-label">获奖级别：</label>
        <div class="col-sm-10 ">
         <select class="form-control" name="achieve_lv">
			<?php $_from = $this->_tpl_vars['prizelv']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
			<option value="<?php echo $this->_tpl_vars['value']['prizelv_id']; ?>
"> <?php echo $this->_tpl_vars['value']['prizelv_name']; ?>
</option>
			<?php endforeach; endif; unset($_from); ?>
		 </select>
        </div>
      </div>
	  <div class="form-group">
        <label for="" class="col-sm-2  control-label"><?php if ($this->_tpl_vars['type'] == 6): ?>发表者<?php else: ?>获奖人<?php endif; ?>：</label>
        <div class="col-sm-10 ">
         <?php if ($this->_tpl_vars['type'] == 5): ?><input type="text" name="achieve_owner" id="achieve_owner" class="form-control" required="required">
		<?php else: ?><select class="form-control" name="achieve_owner">
			<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
			<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
			<?php endforeach; endif; unset($_from); ?>
		</select><?php endif; ?>
        </div>
      </div>
	  <div class="form-group">
        <label for="" class="col-sm-2  control-label"><?php if ($this->_tpl_vars['type'] == 6): ?>发表日期<?php else: ?>获奖日期<?php endif; ?>：</label>
        <div class="col-sm-10 ">
         <input type="text" class="form-control" name="achieve_time"  id="datepicker" />
        </div>
      </div>
	  <?php if ($this->_tpl_vars['type'] == 5): ?>
	  <div class="form-group">
        <label for="" class="col-sm-2  control-label">第一指导老师：</label>
        <div class="col-sm-10 ">
			<select class="form-control" name="achieve_teach">
				<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
				<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
				<?php endforeach; endif; unset($_from); ?>
			</select>
        </div>
      </div>
	  <div class="form-group">
        <label for="" class="col-sm-2  control-label">其他指导老师：</label>
        <div class="col-sm-10 ">
			<select class="form-control select2" name="achieve_teachers[]" multiple="multiple" data-placeholder="选择老师（可多选）">
				<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
				<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
"> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
				<?php endforeach; endif; unset($_from); ?>
			</select>
        </div>
      </div>
	  <?php endif; ?>
	  <div class="form-group">
        <label for="" class="col-sm-2  control-label">附件：</label>
        <div class="col-sm-10 ">
         <input type="file"  name="achieve_file" multiple="multiple">
        </div>
      </div>
	  <?php if ($this->_tpl_vars['type'] == 5): ?>
	  <div class="form-group">
        <label for="" class="col-sm-2  control-label">是否同步到指导老师奖：</label>
        <div class="col-sm-10 ">
         <input type="checkbox" name="same">
        </div>
      </div>
	  <?php endif; ?>  
    </form>
  </div>
  <!--row  end-->
  
  <div class="row row_margin" >
    <button type="submit" class="btn btn-primary btn-lg btn-block btn-primary2">确定</button>
  </div>
</div>
<!--container  end--> 
<!--主体部分  end--> 
<!--底部-->
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "m.index.footer.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<script>
  $(function() {
    $( "#datepicker" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true,
    });
	$( "#datepicker1" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true
    });
	$( "#datepicker2" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true
    });
	$( "#datepicker3" ).datepicker({
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true
    });
  });
  //上传图片
  $(function(){
        var imgurl=[];
        function createfile(){
        $('#updiv').append("<input type='file'  name='photos' class='upfile'>");
        }
        function showimg(url){
            var img='<img src="'+url+'"/>';
            $('#imglist').append(img);
        }
        function addfile(){
            showimg($(this).val());
            $(this).hide();
            createfile();
            $('.upfile').bind('change',addfile);
        }
        $('.upfile').bind('change',addfile);
    })
</script>
<?php if ($this->_tpl_vars['type'] == 5): ?>
<script>
	$(function (){
		$('#achieve_owner').blur(function(){
			var name = $('#achieve_owner').val();
			$.post('index.php?a=achieve.checks',{name:name},function ($data) {
				if($data == 0){alert('未找到相应学生');}
			});
		})
	})
</script>
<?php endif; ?>

<?php if ($this->_tpl_vars['type'] == 6): ?>
<script type="text/javascript">
	$(document).ready(function(){
		$("#new").hide();
		$("#add").hide();

		$("#add").click(function(){
			var na=$("#new").val();
			$.ajax({
				url:"index.php?a=publish.addajax&name="+na,
				type:"get",
				dataType: "json",
				success: function (msg) {
					//alert(msg);
					if(msg!=""){
						$("#s1").append("<option value='"+msg+"'>"+$("#new").val()+"</option>");
						$("#new").val('');
					}
				}
			});
		});
	});
	function a()
	{
		var val = $("#s1").val();
		if (val == '自定义') {
			$("#new").show();
			$("#add").show();
		} else{
			$("#new").hide();
			$("#add").hide();
		};
	}
</script>
<?php endif; ?>
<script src="static/js/select2.min.js"></script>
 <script>
  $(function() {
    $(".select2").select2();
  });
  </script>